<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>

        body{
            width: 3000px;
            height: 3000px;

        }
        button{
            position: fixed;
            bottom: 50px;
            right: 50px;
        }

    </style>

</head>
<body>
    
    <button id="go"> 来了</button>

    <script>
        // 滚动到指定位置
        go.onclick = function(){
            // window.scrollTo(0,0)

            window.scrollTo({
                left:0,
                top:0,
                behavior:'smooth'
            })
        }

    </script>
    
</body>
</html>